<?PHP
    //require 'app_config.php'; 
    //require_once('SUBMAILAutoload.php');
	
	//加载配置
	$message_configs['appid']	 ='16507';
	$message_configs['appkey']	 ='2ee15a6d774d16fde2d469aeb3a46d4a';
	$message_configs['sign_type']='normal';
	
	function SUBMAILAutoload($classname){
		
        $filename = dirname(__FILE__).DIRECTORY_SEPARATOR.'lib/'.strtolower($classname).'.php';
        if (is_readable($filename)) {
            require $filename;
        }
    }
    
    if(version_compare(PHP_VERSION, '5.1.2', '>=')){
        if (version_compare(PHP_VERSION, '5.3.0', '>=')){
            spl_autoload_register('SUBMAILAutoload', true, true);
        }else{
            spl_autoload_register('SUBMAILAutoload');
        }
    }else{
        function __autoload($classname){
            SUBMAILAutoload($classname);
        }
    }
	
	//接收参数
	$code	= isset($_REQUEST["code"])?$_REQUEST["code"]:'';
	$mobile	= isset($_REQUEST["mobile"])?$_REQUEST["mobile"]:'';
	if(empty($mobile) || empty($code)){
		die('参数错误');
	}
	//print_r($_REQUEST);exit;
	
	$submail = new MESSAGEXsend($message_configs);
    $submail->setTo($mobile);		//短信接收的11位手机号码
    $submail->SetProject('BApIh3');		//短信模板ID
    $submail->AddVar('code',$code);	//验证码
    $xsend=$submail->xsend();

    print_r($xsend);

	
	
	/*
	Array ( 
		'status'  		=> 'success',
		'send_id' 		=> 'ced97f18160101f30d2a03f03f267261',
		'fee' 	  		=> '1',
		'sms_credits' 	=> '49' 
	);
	*/